#define _CRT_SECURE_NO_WARNINGS 1

double average(int* salary, int salarySize) {
    int max = 0, min = pow(10, 6) + 1;
    int all = 0;
    for (int i = 0; i < salarySize; i++)
    {
        if (salary[i] > max)
            max = salary[i];
        if (salary[i] < min)
            min = salary[i];
        all += salary[i];
    }
    all = all - max - min;
    return (double)all / (double)(salarySize - 2);
}